/*按钮倒计时*/
var timer;
var countdown = 60;
function settime() {
    if (countdown <= 0) {
        document.getElementById("getcode").removeAttribute("disabled");
        document.getElementById("getcode").innerHTML = "获取验证码";
        $("#getcode").css({"background-color": "#f5802c"});
        clearTimeout(timer);
        countdown = 60;
        return;
    }
    document.getElementById("getcode").setAttribute("disabled", true);
    document.getElementById("getcode").innerHTML = "重新发送(" + countdown + ")";
    countdown = countdown - 1;
    $("#getcode").css({"background-color": "#cccccc"});
    timer = setTimeout("settime()", 1000);
}

//用户名格式判断
function judgeNickname(name){
    if(name&&name.length>0){
        var fist = name.substring(1, 0);
    }
    if (!name||name.length == 0) {
        input_alert("用户名不能为空！");
        return false;
    }
    else if (name.length < 2 || name.length > 16) {
        input_alert("用户名限2-16字符之间！",3000);
        return false;
    }
    else if (!fist.match(/^[\u4E00-\u9FA5a-zA-Z]/)) {
        input_alert("用户名只能以英文字母或汉字开头！",3000);
        return false;
    }
    else if (!name.match(/^[\u4E00-\u9FA5a-zA-Z0-9]+$/)) {
        input_alert("用户名不能为特殊符号！",3000);
        return false;
    }
    return true;
}
//密码格式判断
function judgePass(pass){
    if (!pass||pass.length == 0) {
        input_alert("密码不能为空！");
        return false;
    }
    else if(pass.length < 8 || pass.length > 24) {
        input_alert("密码限8-24字符之间！",3000);
        return false;
    }
    return true;
}
